package com.nervenets.shopping.hibernate.domain.order;

import com.nervenets.general.hibernate.DomainObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;

import javax.persistence.Entity;
import javax.persistence.Table;

@EqualsAndHashCode(callSuper = true)
@Entity
@Table
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class BonusSharing extends DomainObject {
    @ApiModelProperty(value = "年份")
    private int year;
    @ApiModelProperty(value = "第几周")
    private int week;
    @ApiModelProperty(value = "开始时间")
    private long startTime;
    @ApiModelProperty(value = "结束时间")
    private long endTime;
    @ApiModelProperty(value = "总金额")
    private long totalMoney;
    @ApiModelProperty(value = "分红比例")
    private int ratio;
    @ApiModelProperty(value = "是否完成")
    private boolean finished;

    public long getBonus() {
        return totalMoney * ratio / 100;
    }
}
